<template>
  <van-pull-refresh
    v-model="isLoading"
    class="pulldown-page"
    @refresh="refreshHandler"
  >
    <div ref="page" class="inner-page">
      <slot />
    </div>
  </van-pull-refresh>
</template>
<script>
export default {
  name: 'LPulldown',
  props: {
    refresh: {
      type: Function,
      default: () => new Promise(resolve => {
        setTimeout(() => {
          resolve(true)
        }, 100000)
      })
    }
  },
  data() {
    return {
      isLoading: false,
      computeHeight: 80
    }
  },
  methods: {
    async refreshHandler() {
      await this.refresh()
      this.isLoading = false
    }
  }
}
</script>
<style lang="less" scoped>
.pulldown-page {
  flex: 1;
  height: 100%;
  overflow-y: scroll;
  /deep/.van-pull-refresh__track {
    min-height: 100%;
    height: auto;
    .van-pull-refresh__head {
      .van-loading__text {
        color: #000000;
      }
      .van-loading__spinner {
        color: #000000 !important;
      }
    }
  }
  .inner-page{
    min-height: 100%;
    height: auto;
    position: absolute;
    left: 0;
    right: 0;
  }
}
</style>
